package com.cherrish.demo.bio;

import java.io.IOException;
import java.io.OutputStream;
import java.net.Socket;
import java.nio.charset.Charset;
import java.util.Scanner;

/**
 * @author cherrish
 * @time 2019-02-25 11:16
 * @name BClient
 * @desc:
 */
public class BClient {
    public static void main(String[] args) {
        BClient client = new BClient();
        client.run();
    }

    public void run(){
        try(Socket socket = new Socket("localhost", 9010);
            OutputStream out = socket.getOutputStream();) {
            //connection reset
            /*Socket socket = new Socket("localhost", 9010);
            OutputStream out = socket.getOutputStream();*/

            Scanner scanner = new Scanner(System.in);
            String msg = scanner.nextLine();
            out.write(msg.getBytes(Charset.forName("UTF-8")));
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
